<%@ page language="java" contentType="text/html; charset=utf8"
         pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta content="text/html; charset=utf8" http-equiv="Content-Type" >
    <title><spring:message text="Owners" /></title>
</head>
<body>

<jsp:include page="menu/menu.jsp" />

<h2><spring:message text="Owners" /></h2>

<form:form method="post" action="owneradd" commandName="owner">
    <table>
        <tr>
            <th><form:label path="lastName">
                <spring:message text="lastname"/>
            </form:label></th>
            <th><form:label path="firstName">
                <spring:message text="firstname"/>
            </form:label></th>
            <th><form:label path="middleName">
                <spring:message text="middlename"/>
            </form:label></th>
            <th><form:label path="phone">
                <spring:message text="phone"/>
            </form:label></th>
            <th><form:label path="address">
                <spring:message text="address"/>
            </form:label></th>
            <th><form:label path="other">
                <spring:message text="other"/>
            </form:label></th>
        </tr>
        <tr>
            <td><form:input path="lastName" cssClass="unique-input"/></td>
            <td><form:input path="firstName" cssClass="unique-input"/></td>
            <td><form:input path="middleName"/></td>
            <td><form:input path="phone" cssClass="unique-input"/></td>
            <td><form:input path="address"/></td>
            <td><form:input path="other"/></td>
        </tr>
    </table>

    <tr>
        <td colspan="2"><input type="submit" value="<spring:message text="Add"/>"/></td>
    </tr>

</form:form>

<h3><spring:message text="List owners"/></h3>
<c:if test="${!empty ownerList}">
    <table class="data">
        <tr>
            <th><spring:message text="#"/></th>
            <th><spring:message text="lastname"/></th>
            <th><spring:message text="firstname"/></th>
            <th><spring:message text="middlename"/></th>
            <th><spring:message text="phone"/></th>
            <th><spring:message text="address"/></th>
            <th><spring:message text="other"/></th>
            <th>&nbsp;</th>
        </tr>
        <c:forEach items="${ownerList}" var="owner">
            <tr>
                <td>${owner.id}</td>
                <td>${owner.lastName}</td>
                <td>${owner.firstName}</td>
                <td>${owner.middleName}</td>
                <td>${owner.phone}</td>
                <td>${owner.address}</td>
                <td>${owner.other}</td>
                <td><a href="ownerdel/${owner.id}"><spring:message text="Delete"/></a></td>
            </tr>
        </c:forEach>
    </table>
</c:if>

</body>
</html>